<html>
  <head>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<style>
		body {
			font-family: Arial;
		}
	</style>
	<script type="text/javascript">
		var CLIENT_ID = '545290267853-fc804hsas0mvaj35rh87l9r5dduentio.apps.googleusercontent.com';
		var SCOPES = 'https://www.googleapis.com/auth/drive';

		function handleClientLoad() {
			window.setTimeout(checkAuth, 1);
		}

		function checkAuth() {
			gapi.auth.authorize(
				{'client_id': CLIENT_ID, 'scope': SCOPES, 'immediate': true},
				handleAuthResult);
		}

		function handleAuthResult(authResult) {
			if (authResult && !authResult.error) {
				location.redirect = '<?php echo $_REQUEST['url'] ?>';
			} else {
				// No access token could be retrieved, show the button to start the authorization flow.
				status.innerHTML = "NOT Authorized.";
			}
		}
      
		function authorize() {
			gapi.auth.authorize(
				{'client_id': CLIENT_ID, 'scope': SCOPES, 'immediate': false},
				handleAuthResult);
		}
		
	</script>
    <script type="text/javascript" src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
</head>
<body onLoad="checkAuth()">
	<div id="status"><h3>Downloading. Please wait...</h3></div>
</body>
</html>